 ﻿<!doctype html>

<html class="x-admin-sm">



<head>

<meta charset="UTF-8">

<title>OA办公系统</title>

<meta name="renderer" content="webkit|ie-comp|ie-stand">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />

<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="stylesheet" href="./css/font.css">

<link rel="stylesheet" href="./css/xadmin.css">

<link rel="stylesheet" type="text/css" href="css/naranja.min.css" />

<!-- <link rel="stylesheet" href="./css/theme5.css"> -->

<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>

<script src="./lib/layui/layui.js" charset="utf-8"></script>

<script type="text/javascript" src="./js/xadmin.js"></script>

<script src="js/naranja.js" type="text/javascript" charset="utf-8"></script>

<script src="js/global.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>

<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->

<!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>

          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

        <![endif]-->

<style type="text/css">

.nav-link {

position: relative;

padding: 0 14px;

line-height: 34px;

font-size: 10px;

font-weight: bold;

color: #555;

text-decoration: none;

}



.nav-link:hover {

color: #333;

text-decoration: underline;

}



.nav-counter {

position: absolute;

top: 0.6em;

right: 1px;

min-width: 8px;

height: 20px;

line-height: 20px;

margin-top: -11px;

padding: 0 6px;

font-weight: normal;

color: white;

text-align: center;

text-shadow: 0 1px rgba(0, 0, 0, 0.2);

background: #e23442;

border: 1px solid #911f28;

border-radius: 11px;

background-image: -webkit-linear-gradient(top, #e8616c, #dd202f);

background-image: -moz-linear-gradient(top, #e8616c, #dd202f);

background-image: -o-linear-gradient(top, #e8616c, #dd202f);

background-image: linear-gradient(to bottom, #e8616c, #dd202f);

-webkit-box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 1px rgba(0, 0, 0, 0.12);

box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, 0.1), 0 1px rgba(0, 0, 0, 0.12);

}



.nav-counter-green {

background: #75a940;

border: 1px solid #42582b;

background-image: -webkit-linear-gradient(top, #8ec15b, #689739);

background-image: -moz-linear-gradient(top, #8ec15b, #689739);

background-image: -o-linear-gradient(top, #8ec15b, #689739);

background-image: linear-gradient(to bottom, #8ec15b, #689739);

}



.nav-counter-red {

background: red;

border: 1px solid red;

background-image: -webkit-linea r-gradient(top, red, red);

background-image: -moz-linear-gradient(top, red, red);

background-image: -o-linear-gradient(top, red, red);

background-image: linear-gradient(to bottom, red, red);

}



.nav-counter-blue {

background: #3b8de2;

border: 1px solid #215a96;

background-image: -webkit-linear-gradient(top, #67a7e9, #2580df);

background-image: -moz-linear-gradient(top, #67a7e9, #2580df);

background-image: -o-linear-gradient(top, #67a7e9, #2580df);

background-image: linear-gradient(to bottom, #67a7e9, #2580df);

}

</style>

<script>

// 是否开启刷新记忆tab功能

var is_remember = false;

</script>

</head>



<body class="index">

<!-- 顶部开始 -->

<div class="container">

<div class="logo">

<a href="./index.html">OA办公系统管理</a>

</div>

<div class="left_open">

<a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>

</div>



<ul class="layui-nav right" lay-filter="">

<li class="layui-nav-item">

<a href="javascript:;" onclick="xadmin.add_tab('消息通知','message.html',true)" class="nav-link">

<i class="layui-icon" style="font-size: 20px;">&#xe667;</i>

<!--<div class="nav-counter nav-counter-red" id="msgCount"></div>-->

</a>

</li>

<li class="layui-nav-item">

<a href="javascript:;" id="spName"></a>

<dl class="layui-nav-child">

<!-- 二级菜单 -->

<dd>

<a id="xgmm" href="./update-pwd.html">修改密码</a>

</dd>

<dd>

<a href="#" id="logout">安全退出</a>

</dd>
<dd id="outsaker">

<!--<a href="#" id="logout">签退</a>-->

</dd>

</dl>

</li>

</ul>

</div>

<!-- 顶部结束 -->

<!-- 中部开始 -->

<!-- 左侧菜单开始 -->

<div class="left-nav">

<div id="side-nav">

<ul id="nav">



</ul>

</div>

</div>

<!-- <div class="x-slide_left"></div> -->

<!-- 左侧菜单结束 -->

<!-- 右侧主体开始 -->

<div class="page-content">

<div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">

<ul class="layui-tab-title">

<li class="home">

<i class="layui-icon">&#xe68e;</i>工作台</li>

</ul>

<div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">

<dl>

<dd data-type="this">关闭当前</dd>

<dd data-type="other">关闭其它</dd>

<dd data-type="all">关闭全部</dd>

</dl>

</div>

<div class="layui-tab-content">

<div class="layui-tab-item layui-show">

<iframe src='welcome.html' frameborder="0" scrolling="yes" class="x-iframe"></iframe>

</div>

</div>

<div id="tab_show"></div>

</div>

</div>

<div class="page-content-bg"></div>

<style id="theme_style"></style>
		<script>
			layui.use('form', function() {
				var $ = layui.jquery; //引入jquery
				//解决跨域
				  $.ajaxPrefilter(function(options, originalOptions, jqXHR) {
				          options.xhrFields = {
				            withCredentials: true
				          }
				        })
				$(function() {
					$.ajax({
						type: "post",
						url: globalData.server +"./Modules/getAllModuless?userId="+globalData.getUid(),
						dataType: "json",
						success: function(data) {
					 $("#nav").html("");
			            $.each(data, function(n, value) {
			              var s = '<li><a href="javascript:;"><i class="iconfont left-nav-li" lay-tips=' + value.name + '>&#xe6b8;</i><cite>' + value.name + '</cite><i class="iconfont nav_right">&#xe697;</i></a><ul class="sub-menu">';
			              for(var i = 0; i < value.children.length; i++) {
			                var cr = value.children[i];
			                s += '<li><a onclick="xadmin.add_tab(\'' + cr.name + '\',\'' + cr.path + '\')"><i class="iconfont">&#xe6a7;</i><cite>' + cr.name + '</cite></a></li>';
			              }
			              s += "</ll></li>";
			              $("#nav").append($(s));
			            });

						}

					});
				})
				$("#spName").html(globalData.getUserName());
				//安全退出,判断是不是管理员登录，是否签到 是否签退
				$("#logout").click(function() {
					$.ajax({
						type: "post",
						url: globalData.server + "./asker/askerYesNo?loginName=" + globalData.getUserName(), //据登录名查询是否该签退
						dataType: "json",
						success: function(data) {
							if(data.count > 0) { //判断是不是管理员登录
								$.ajax({//判断是否签到
									type: "post",
									url: globalData.server + "./asker/askerTime?askerName=" + globalData.getUserName(), //据登录名查询是否该签退
									dataType: "json",
									success: function(data2) { //再去判断是否已经签到
										if(data2.data !=null) { //！=null已签到 追加
											console.log(data2);
									$.ajax({//判断 是否签退
									type: "post",
									url: globalData.server + "./asker/askerOutTime?askerName=" + globalData.getUserName(), //据登录名查询是否该签退
									dataType: "json",
									success: function(data1) { //再去判断是否已经签退
										if(data1.count == 0) { //=0未签退  提示是否退出
											layer.confirm("还没有签退，你确定要退出吗？", {
											icon: 3,
											title: "退出系统"
										}, function(index) {
											globalData.loginOut();
											layer.close(index);
										}, function(index) {
											layer.close(index);
										});
										}else{//签退后 退出
											layer.confirm("你确定要退出吗？", {
											icon: 3,
											title: "退出系统"
										}, function(index) {
											globalData.loginOut();
											layer.close(index);
										}, function(index) {
											layer.close(index);
										});
										}
									}

								});
								}else{//未签到退出
									layer.confirm("你确定要退出吗？", {
									icon: 3,
									title: "退出系统"
								    }, function(index) {
									globalData.loginOut();
									layer.close(index);
								    }, function(index) {
									layer.close(index);
									});
									}
									}
								});
							}else{//管理员登录可以直接退出
								layer.confirm("你确定要退出吗？", {
								icon: 3,
								title: "退出系统"
								}, function(index) {
								globalData.loginOut();
								layer.close(index);
								}, function(index) {
								layer.close(index);
								});
							}
						}
					});
					
					
					
				});
				////					签退
					$.ajax({
						type: "post",
						url: globalData.server + "./asker/askerYesNo?loginName=" + globalData.getUserName(), //据登录名查询是否该签退
						dataType: "json",
						success: function(data3) {
							$("#outsaker").html("");
							if(data3.count > 0) { //签到按钮显示，
								$.ajax({//判断是不是管理员登录
									type: "post",
									url: globalData.server + "./asker/askerTime?askerName=" + globalData.getUserName(), //据登录名查询是否该签退
									dataType: "json",
									success: function(data2) { //再去判断是否已经签到
										if(data2.data !=null) { //！=null已签到 追加
											console.log(data2.data);
									$.ajax({//判断 是否签退
									type: "post",
									url: globalData.server + "./asker/askerOutTime?askerName=" + globalData.getUserName(), //据登录名查询是否该签退
									dataType: "json",
									success: function(data1) { //再去判断是否已经签退
										if(data1.count == 0) { //=0未签退 追加
											$("#outsaker").append('<a href="#" onclick="outAskers()">签退</a>');
										}
									}

								});
										}
									}

								});
							}
						}
					});
			});
			//监听提交签退
			function outAskers() {
				layer.confirm("你确定签退吗？", {
						icon: 3,
						title: "签退操作"
					}, function(index) {
						var d = {
						'askerName': globalData.getUserName(),
						}; //表单中的数据，定义一个对象来接收
						var url = globalData.server + './asker/update';
						$.post(url, d, function(data) {
							console.log(data);
							if(data.count > 0) {
								layer.msg(data.msg, {
									icon: 6
								});
								setTimeout(function() {
									window.parent.location.reload();
		//							window.location.reload(); //刷新页面
								}, 2000);
							}else{
								layer.msg(data.msg, {
									icon: 6
								});
							}
						}, "json");
						layer.close(index);
					}, function(index) {
						layer.close(index);
					});
				
			}
		</script>
	</body>

</html>